package br.com.fogas.webservice.repository.soap;

import android.content.Context;
import br.com.fogas.utils.exception.ParseXmlException;
import br.com.fogas.webservice.exception.ERaiseWebServiceException;
import br.com.fogas.webservice.exception.RespostaWebServiceException;
import br.com.fogas.webservice.exception.SemConexaoInternetException;
import br.com.fogas.webservice.exception.ServidorForaException;
import br.com.fogas.webservice.exception.TempoEsperaRespostaException;
import br.com.fogas.webservice.exception.WebServiceException;
import br.com.fogas.webservice.parser.finalizar_plano.FinalizaPlanoEnvelope;
import br.com.fogas.webservice.parser.finalizar_plano.FinalizaPlanoRequest;
import br.com.fogas.webservice.parser.finalizar_plano.FinalizaPlanoResponse;
import br.com.fogas.webservice.repository.IRepositoryHandler;
import br.com.fogas.webservice.soap.impl.FinalizaPlanoSOAP;

public class FinalizaPlanoRepository implements IRepositoryHandler<FinalizaPlanoResponse> {

	private Context context;
	private FinalizaPlanoRequest request;

	public FinalizaPlanoRepository(Context context, FinalizaPlanoRequest request) {
		this.context = context;
		this.request = request;
	}
	
	@Override
	public FinalizaPlanoResponse getResponse()
			throws SemConexaoInternetException, ParseXmlException,
			TempoEsperaRespostaException, ServidorForaException,
			RespostaWebServiceException, WebServiceException,
			ERaiseWebServiceException {

		FinalizaPlanoEnvelope envelope = new FinalizaPlanoEnvelope();
		envelope.body.request= request;
		
		FinalizaPlanoSOAP soap = new FinalizaPlanoSOAP(context, envelope);
		return soap.getResponse();
	}

}
